package com.chookss.home.audit.clockIn;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.chookss.R;
import com.chookss.view.BaseDialog;
import com.chookss.view.listener.ShareChoiceDialogListener;
import com.chookss.view.listener.ShareDialogListener;

import butterknife.BindView;

public class DateChoiceDialog extends BaseDialog {


    @BindView(R.id.tvMorning)
    TextView tvMorning;
    @BindView(R.id.tvAfternoon)
    TextView tvAfternoon;
    private Context context;
    private ShareChoiceDialogListener listener=null;
    public DateChoiceDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_date_choice;
    }

    @Override
    protected void init(View view) {
        initCenter(0.3f);
        tvMorning.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null) {
                    listener.onClick(0);
                }
                dismiss();
            }
        });
        tvAfternoon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null) {
                    listener.onClick(1);
                }
                dismiss();
            }
        });
    }
    public DateChoiceDialog(@NonNull Context context,  ShareChoiceDialogListener listener) {
        super(context);
        this.context = context;
        this.listener=listener;
//        ；即可实现点击外部不消失
        setCanceledOnTouchOutside(false);
        setCancelable(false);
    }
}
